package com.bckj.freshnow.user.mapper;

import com.bckj.freshnow.user.entity.User;
import com.bckj.freshnow.user.model.UserResponse;
import com.bckj.freshnow.user.model.UserRequest;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.jdbc.SQL;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;

/**
 * 用户表(User)表数据库访问层
 *
 * @author makejava
 * @since 2025-04-21 09:43:56
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
      * 列表
      *
      * @param request req
      * @return list
      */
    @SelectProvider(method = "findAll" , type = UserProvider.class)
    List<UserResponse> findAll(UserRequest request);
    
    class UserProvider{
        
        public String findAll(UserRequest request){
            SQL sql = new SQL();
            sql.SELECT("id, name, phone, gender, birthday, update_time, create_time ");
            sql.FROM("user");
            return sql.toString();
        }
    }
}

